function columns = dependenceSearch( m, ind ) %return array of independent   

    if length(ind) == 1
        columns = ind;
        return;
    end
    
    nrows = length(ind);    
% vectors = rows    , ind = allowed indices

    if isIndependent(m) == false
        for i = 1:nrows
            rr = [ ind( 1:(i-1) ) ind( (i+1):nrows ) ];
            mt = m(rr,:);
            if isIndependent(mt) == true
                indfound = true;
                columns = rr;
                return;
            end
        end
        dependenceSearch(m, )        
    end
    columns = 1:nrows;
end

function r = isIndependent(vs)
    fr = min(size(vs));
    rr = rank(vs);
    
    if fr == rr
        r = true;
    else 
        r = false;
    end
end

function r = span(v, vs)
% Test whether or not vector v is in the span of a set
% of vectors.
    A = [];
    sz = size(vs); %rows - vectors
    n = vs(1);
    for i=1:n
       u = vs(i,:);
       u = u';
       A = [A u(:)];
    end
    v = v';
    v = v(:);
    if rank(A) == rank([A v])
       r = 1;
    else
       r = 0;
    end
end

